import localQustions from './questionsList.js'

const getQuestionsFromLocal = function() {
	return localQustions.questions
}

//从服务器获取
const getQuestionsFromServer = function(id, onSuccess, onFail, onComplete) {
	uni.request({
		url: "",
		method:'GET',
		data: {
			id: id.toString()
		},
		complete() {
			if (onComplete != null) {
				onComplete.invoke()
			}
		},
		success(res) {
			if (onSuccess != null) {
				onSuccess.invoke(res)
			}
		},
		fail() {
			if (onFail != null) {
				onFail.invoke()
			}
		}
	})
}

module.exports = {
	getQuestionsFromLocal,
	getQuestionsFromServer
}
